//
//  LetterCell.swift
//  VastSwift
//
//  Created by GoodSrc on 2021/5/20.
//

import UIKit
// 分类页面 右侧字母cell
class LetterCell: UITableViewCell {

    /// 类型label
    var firstTitle  : UILabel?

    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.uiConfig()
    }
    func uiConfig() {
        self.contentView.backgroundColor = UIColor.white

        firstTitle = UILabel.init(frame: CGRect.init(x: 0, y: 2, width: 12, height: 12))
        firstTitle?.backgroundColor = .white
        firstTitle?.font = .systemFont(ofSize: 10)
        firstTitle?.textColor = .black
        firstTitle?.layer.cornerRadius = 6
        firstTitle?.layer.masksToBounds = true
        firstTitle?.textAlignment = .center
        self.contentView.addSubview(firstTitle!)
    }
    
    /// 设置选中状态和文本
    /// - Parameters:
    ///   - text: 显示文本
    ///   - select: 是否选中
    func selectStatus(text: String, select: Bool)  {
        firstTitle?.text = text
        if select {
            firstTitle?.textColor = .white
            firstTitle?.backgroundColor = colorTheme
        } else {
            firstTitle?.textColor = .black
            firstTitle?.backgroundColor = .white
        }
    }
}
